import hyRequest from '@/services/index'

/* 针对页面的网络请求, 增删改查 */
export function postPageListData(pageName: string, queryInfo: any) {
  return hyRequest.post<any>({
    url: `/${pageName}/list`,
    data: queryInfo
  })
}

export function deletePageById(pageName: string, id: number) {
  return hyRequest.delete<any>({
    url: `/${pageName}/${id}`
  })
}

export function newPageData(pageName: string, pageInfo: any) {
  return hyRequest.post<any>({
    url: `/${pageName}`,
    data: pageInfo
  })
}

export function editPageData(pageName: string, id: number, pageInfo: any) {
  return hyRequest.patch<any>({
    url: `/${pageName}/${id}`,
    data: pageInfo
  })
}
